import regeneratorRuntime from '../../plugins/regenerator-runtime.js'
import { addVisitorFrequency } from '../../utils/encapsulation.js'//数据监控
import { Request_API_CN, Request_API_COM } from '../../utils/index.js'//封装请求
import login from '../../api/login.js';
import { prefix, surface } from '../../api/config.js';
const app = getApp();
let _this
Page({
  data: {
    commission:"",
    value:'',
    notes:[]
  },
  onLoad: function (e) {
    _this = this;
    console.log(e)
    // e.commission = 100;
    _this.notes()
    _this.setData({
      commission: e.commission
    })

  },
  bindinput:(e)=>{//输入框输入
    _this.setData({
      value: e.detail.value
    })
  },
  formSubmit:(e)=>{//提交表单
    _this.withdrawApply(e.detail.value)
  },
  withdrawApply:(obj)=>{//提现
    
    Request_API_CN(prefix+'/withdrawApply', 'POST', { openid: app.globalData.openid, money: _this.data.commission, account: obj.Alipay, tel: obj.call, nickname:obj.name})
      .then((res) => {
        console.log(res)
        if (res.data.code == 1) {

         

          //延时回退
          wx.redirectTo({
            url: "/pages/user-putSuccess/user-putSuccess"
          }) 

        } else {

          wx.showToast({
            title: res.data.message,
            icon: "none",
            mask: true
          })

        }

      })
  },
  notes: () => {//代理须知
    Request_API_CN(prefix+'/Notes', 'POST', {})
      .then((res) => {
        _this.setData({
          notes:res.data.data
        })
        console.log(res.data.data)
      })
  },
})